<template>
  <div>
    <h3>组件C中设置的 props {{ name }}</h3>
    <h3>组件C中设置的状态 {{ state }}</h3>
    <p>组件C中设置的 $attrs {{ $attrs }}</p>
    <p>组件C中设置的 $listeners {{ $listeners }}</p>
    <button @click="triggerState">切换状态</button>
  </div>
</template>
<script>
export default {
  inheritAttrs: false,
  props: {
    name: {
      type: String,
      default: 'Vue'
    },
    state: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {

    }
  },
  mounted () {
    this.$emit('test2-component-c')
    console.log('ComponentC', this.$attrs, this.$listeners)
  },
  methods: {
    triggerState () {
      this.$emit('trigger-state')
    }
  }
}
</script>
